﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Medianamik.Core;
using Medianamik.UI.Web.MVP.Presentation;
using Medianamik.UI.Web.MVP.View;

namespace Medianamik.UI.Web.Shop
{
    public partial class ShopEditProductType: PageModuleViewWithPresenter<ModulePresenter<IEditProductTypeView>>, IEditProductTypeView
    {
        public HyperLink CancelButton
        {
            get { return CancelLink; }
        }

        protected void Save(object sender, EventArgs e)
        {
            if(Page.IsValid)
            {
                OnSave.Raise(this, EventArgs.Empty);
            }
        }

        public event EventHandler OnSave;

        public Guid? TypeId
        {
            get { return string.IsNullOrEmpty(QueryString[DefaultParamNames.TypeID]) ? (Guid?)null : new Guid(QueryString[DefaultParamNames.TypeID]); }
        }
 
        public string IconPath
        {
            get { return IconPicker.Value; }
            set { IconPicker.Value = value; }
        }

        public bool CanHaveChildren
        {
            get { return true; }
            set { }
        }

        public bool IsGenerated
        {
            get { return true; }
            set { }
        }

        public bool IsAbstract
        {
            get { return false; }
            set { }
        }

        public bool IsListable
        {
            get { return false; }
            set { }
        }

        public bool IsVersioned
        {
            get { return true; }
            set { }
        }

        public bool IsAdmin
        {
            get { return false; }
            set { }
        }

        public IDictionary<string, string> NodeTypeNameValuesByCulture
        {
            get { return TypeNameTranslations.Values; }
            set { TypeNameTranslations.Values = value; }
        }

        protected global::TypeManagement.Controls.IconPicker IconPicker;
    }

    public interface IEditProductTypeView : INodeTypeEditModuleView
    {
    }
}